package com.squirrel.common.mapper;

import com.squirrel.common.entity.UserSubscription;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * UserSubscriptionMapper  用户关注接口
 * </p>
 *
 * @author 关远键
 * @since 2021/11/11 16:06
 */
@Repository
public interface UserSubscriptionMapper extends BaseMapper<UserSubscription> {

    List<UserSubscription> getByFromId(@Param("fromId") Integer fromId);

    List<UserSubscription> getByToId(@Param("toId") Integer toId);

    Integer deleteSub(@Param("fromId") Integer fromId, @Param("toId") Integer toId);

    // 等待优化
    Integer isExist(@Param("fromId") Integer fromId, @Param("toId") Integer toId);

    // 关注数
    Integer countByFromUserId(@Param("fromId") Integer fromId);

    // 粉丝数
    Integer countByToUserId(@Param("toId") Integer toId);


}
